//
//  GYZSearchTableViewCell.m
//  Qyer
//
//  Created by GYz on 15/10/23.
//  Copyright © 2015年 GF. All rights reserved.
//

#import "GYZSearchTableViewCell.h"
#define CRM(x,y,wid,hei)  CGRectMake((x) / (375.) * [UIScreen mainScreen].bounds.size.width, (y) /(667.) * [UIScreen mainScreen].bounds.size.height , (wid) / (375.) * [UIScreen mainScreen].bounds.size.width  , (hei) / (667.) * [UIScreen mainScreen].bounds.size.height)
@implementation GYZSearchTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.image = [[UIImageView alloc]initWithFrame:CRM(10, 10, SCREEN_WIDTH / 4, SCREEN_WIDTH / 4)];
        [self.contentView addSubview:self.image];
        
        self.cnnameLabel = [[UILabel alloc]initWithFrame:CRM(SCREEN_WIDTH / 4 + 20, 10, SCREEN_WIDTH *3 / 4, 25)];
        [self.contentView addSubview:self.cnnameLabel];
        
        self.ennameLabel = [[UILabel alloc]initWithFrame:CRM(SCREEN_WIDTH / 4 + 20, 30, SCREEN_WIDTH * 3 / 4, 25)];
        self.ennameLabel.textColor = [UIColor grayColor];
        self.ennameLabel.font = [UIFont systemFontOfSize:13.];
        [self.contentView addSubview:self.ennameLabel];
        
        self.beenLabel = [[UILabel alloc]initWithFrame:CRM(SCREEN_WIDTH / 4 + 20, 80, SCREEN_WIDTH * 3 / 4, 25)];
        self.beenLabel.textColor = [UIColor lightGrayColor];
        self.beenLabel.font = [UIFont systemFontOfSize:12.0];
        [self.contentView addSubview:self.beenLabel];
        
        self.label = [[UILabel alloc]initWithFrame:CRM(SCREEN_WIDTH - 50, SCREEN_WIDTH / 8, 60, 25)];
        self.label.font = [UIFont systemFontOfSize:14.];
        self.label.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:self.label];
        
        self.countryLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 4 + 20, 60, SCREEN_WIDTH * 3 / 4, 25)];
        self.countryLabel.textColor = [UIColor lightGrayColor];
        self.countryLabel.font = [UIFont systemFontOfSize:12.0];
        [self.contentView addSubview:self.countryLabel];
        
    }
    return self;
}

- (void)setValueWith:(GYZSearchModel *)model
{
    [self.image sd_setImageWithURL:[NSURL URLWithString:model.photo] placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    self.cnnameLabel.text = model.cnname;
    self.ennameLabel.text = model.enname;
    self.beenLabel.text = model.beenstr;
    self.label.text = model.label;
    self.countryLabel.text = [NSString stringWithFormat:@"%@/%@", model.parent_parentname, model.parentname];
    self.beenLabel.text = model.beenstr;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
